'use strict';

module.exports = function collectSameElements(collectionA, objectB) {
  let arr = [] ;
  for(let item1 of collectionA){
    for(let item2 of objectB.value){
      if(item1.key === item2){
        arr.push(item1.key) ;
      }
    }
  }
  return arr;
}
// const collectionA = [
//   {key: 'a'}, {key: 'e'}, {key: 'h'}, {key: 't'}, {key: 'f'}, {key: 'c'}, {key: 'g'}, {key: 'b'}, {key: 'd'}
// ];
// const collectionB = {value: ['a', 'd', 'e', 'f']};
// console.log(collectSameElements(collectionA,collectionB)) ;